Fixes #22967: move auto-assigned incidents to the Assigned stage - #30594
Fixes #22967: move auto-assigned incidents to the Assigned stage#30594IceS2 wants to merge 14 commits into
Conversation
An incident created on test failure already inherits its assignees from the test case owners, but the resolution workflow always entered NewStage and nothing ever advanced it. The incident stayed in New, and because the TCRS mirror only carries assignee details on Assigned records, the Incident Manager rendered it as unassigned even though the task had assignees. Drive the workflow's own "assign" transition right after the incident task is created when assignees resolved, so the incident lands on the Assigned stage with the owner attached and the TCRS record carries the assignee. Incidents without owners are untouched and stay in New. Stage and transition ids of TestCaseResolutionTaskWorkflow move into IncidentWorkflowStages so the TCRS sync handler and the new assignment path cannot drift apart.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Log a warning when an incident has assignees but is not at the New stage, so a broken assumption about synchronous workflow start surfaces instead of silently leaving the incident unassigned. Assert the typed assignee id on the Assigned TCRS record rather than substring-matching the serialized details blob, which could pass on an incidental match elsewhere in the payload.
The incident raised by the pipeline re-run in "Resolving incident & re-run pipeline" is created after the table has an owner, so it now opens as Assigned rather than New and the hardcoded expectation no longer holds. Give acknowledgeTask an initialStatus parameter defaulting to New, and pass Assigned at that one call site. The other three call sites act on incidents raised before ownership is claimed and keep the default.
…gned-if-auto-assigned' into fix-incident-should-move-to-assigned-if-auto-assigned
table3 is given an owner in beforeAll, so the incident raised by its Consistency failure is auto-assigned on creation and never opens as New.
The Assigned stage offers only reassign and resolve, so an auto-assigned incident cannot be acknowledged. The rerun step in "Resolving incident & re-run pipeline" only needs to confirm a fresh incident exists before checking the open/closed counts, so assert its status directly. Adds verifyIncidentStatus for that and restores acknowledgeTask to its original shape, since every remaining caller acts on an incident raised before the table gained an owner.
Callers go on to openIncidentTaskTab, whose Incident tab only exists on the test case details page. acknowledgeTask navigated there as a side effect; verifyIncidentStatus replaced it at one call site and stopped short, leaving the run on the table's Data Quality tab.
…gned-if-auto-assigned' into fix-incident-should-move-to-assigned-if-auto-assigned
Code Review 👍 Approved with suggestions 2 resolved / 3 findingsAdds automatic workflow advancement for newly created incidents with inherited assignees and centralizes stage identifiers. Consider addressing the transaction handling in persistRecord to prevent nested transaction overhead. 💡 Bug: persistRecord opens its own transaction inside
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source
Fixes #22967
Problem
An incident task created on test failure already inherits its assignees from the test case owners (
TestCaseResolutionStatusRepository.createIncidentTask), butTestCaseResolutionTaskWorkflowalways entersNewStageand nothing ever advances it — the only edges out ofNewStageare theack/assign/resolvetransitions a user fires by hand.Two symptoms follow from that single cause:
IncidentTcrsSyncHandler.buildDetailsForStageonly attaches assignee details toAssignedrecords, and the Incident Manager reads the assignee fromtestCaseResolutionStatusDetails.assigneeon the TCRS time series rather than from the taskFix
After the incident task is created, if assignees resolved, drive the workflow's own
assigntransition viaresolveTaskWithWorkflow— the same path a manual assignment takes. Theassigntransition targetsInProgress, so it takes the non-terminal branch: the workflow advances toAssignedStage,CreateTaskstampsworkflowStageId=assigned/status=InProgress, and the resultingpostUpdatemakes the TCRS sync emit anAssignedrecord carrying the assignee.Guarded so it only fires when assignees are non-empty, the task actually sits at stage
new, and anassigntransition is available. Best-effort: an incident that fails to advance is still a usable incident in New, so it never fails test-result ingestion.Incidents with no owners are untouched and stay in New.
Stage and transition ids of the workflow move into a new
IncidentWorkflowStagesholder so the TCRS sync handler and this new path cannot drift apart.InProgressis already inTaskRepository.OPEN_TASK_STATUSES, so incident de-duplication (getOrCreateIncident) andautoCloseIncidentboth still find the incident after it leavesOpen.Verification
AutoAssignIncidentITcovers both directions — owned test case reachesassigned/InProgresswith the owner on the TCRSAssignedrecord, unowned test case staysnew/Openwith noAssignedrecord.Confirmed end to end against a locally built stack:
Known limitation
SetApprovalAssigneesImplstrips the requester from the assignee list to prevent self-approval and does not add them back for workflow-managed tasks. If the user who triggered the test run is the sole owner, the incident ends up unassigned and stays in New — same as a manual assign behaves today. Not addressed here.Greptile Summary
Moves newly created incidents with inherited assignees through the workflow’s existing assignment transition.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Test as Test Result Ingestion participant Repo as Resolution Status Repository participant Task as Task Repository participant Workflow as Incident Workflow participant TCRS as TCRS Sync Handler Test->>Repo: Create failed test result Repo->>Task: Create incident with inherited owners alt Incident has assignees Repo->>Task: Resolve "assign" transition Task->>Workflow: Advance New to Assigned Workflow->>Task: "Set stage=assigned, status=InProgress" Task->>TCRS: Publish task update TCRS->>TCRS: Emit Assigned record with assignee else Incident has no assignees Task->>TCRS: Publish New-stage task TCRS->>TCRS: Emit New record endReviews (12): Last reviewed commit: "Merge remote-tracking branch 'origin/fix..." | Re-trigger Greptile
Context used (3)